XR API 2.4
Loading...
Searching...
No Matches
xr_api_defs.h
Go to the documentation of this file.
1
23#ifndef XR_API_DEFS_H_
24#define XR_API_DEFS_H_
25
26#include "xr_math.h"
27
28// = Standard Library =============================
29#include <stdint.h>
30#include <wchar.h>
31
32#include <string>
33
34// XR_PTR_SIZE (in bytes)
35#if (defined(__LP64__) || defined(_WIN64) || \
36 (defined(__x86_64__) && !defined(__ILP32__)) || defined(_M_X64) || \
37 defined(__ia64) || defined(_M_IA64) || defined(__aarch64__) || \
38 defined(__powerpc64__))
39#define XR_PTR_SIZE 8
40#else
41#define XR_PTR_SIZE 4
42#endif
43
44#if !defined(XR_DEFINE_HANDLE)
45#if (XR_PTR_SIZE == 8)
46#define XR_DEFINE_HANDLE(object) typedef struct object##_T* object;
47#else
48#define XR_DEFINE_HANDLE(object) typedef uint64_t object;
49#endif
50#endif
51
52const float kDefaultDisplayWidth_m = 0.3442176f;
53const float kDefaultDisplayHeight_m = 0.1936224f;
54const float kDefaultDisplayTilt_rad = 0.785398f; // = 45f * deg2rad
55const uint32_t kDefaultHorizontalResolution_px = 3840;
56const uint32_t kDefaultVerticalResolution_px = 2160;
57
85
93typedef const char* SonyOzPlatformId;
94
100 UNKNOWN = 0b00000000,
101 IDLE = 0b00000001,
102 READY = 0b00000010,
103 STARTING = 0b00000100,
104 RUNNING = 0b00001000,
105 STOPPING = 0b00010000,
106};
107
114 int32_t left;
115
117 int32_t top;
118
120 int32_t right;
121
123 int32_t bottom;
124};
125
130const uint32_t kDeviceSerialNumberMaxSize = 256;
131const uint32_t kDeviceProductIdMaxSize = 256;
157
163 Single = 0,
164 Virtical = 1,
165 Horizontal = 2,
166 Grid = 3,
167 Clone = 4,
168 Multiple = 5
169};
170
175
183 float angle_up;
185
190 : angle_left(0.f), angle_right(0.f), angle_up(0.f), angle_down(0.f) {}
191
196 SonyOzFovf(float in_angle)
197 : angle_left(in_angle),
198 angle_right(in_angle),
199 angle_up(in_angle),
200 angle_down(in_angle) {}
201
209 SonyOzFovf(float in_angle_left, float in_angle_right, float in_angle_up,
210 float in_angle_down)
211 : angle_left(in_angle_left),
212 angle_right(in_angle_right),
213 angle_up(in_angle_up),
214 angle_down(in_angle_down) {}
215};
216
226 float viewLeft;
229 float viewTop;
230 float nearZ;
231 float farZ;
232
240 SonyOzFrustumPlanesf(float horizontal_fov, float vertical_fov,
241 float near_clip, float far_clip)
242 : viewLeft(near_clip * tanf(horizontal_fov * 0.5f)),
243 viewRight(-near_clip * tanf(horizontal_fov * 0.5f)),
244 viewBottom(-near_clip * tanf(vertical_fov * 0.5f)),
245 viewTop(near_clip * tanf(vertical_fov * 0.5f)),
246 nearZ(near_clip),
247 farZ(far_clip) {}
248
252 SonyOzFrustumPlanesf() : SonyOzFrustumPlanesf(1.47f, 0.70f, 0.15f, 10.f) {}
253
257 SonyOzFrustumPlanesf(float in_view_left, float in_view_right,
258 float in_view_bottom, float in_view_top, float in_near_z,
259 float in_far_z)
260 : viewLeft(in_view_left),
261 viewRight(in_view_right),
262 viewBottom(in_view_bottom),
263 viewTop(in_view_top),
264 nearZ(in_near_z),
265 farZ(in_far_z) {}
266
268 return SonyOzFovf(atan2f(fabsf(viewLeft), fabsf(nearZ)),
269 atan2f(fabsf(viewRight), fabsf(nearZ)),
270 atan2f(fabsf(viewTop), fabsf(nearZ)),
271 atan2f(fabsf(viewBottom), fabsf(nearZ)));
272 }
273};
274
282
285
290
296 SonyOzPosef(SonyOzQuaternionf in_orientation, SonyOzVector3f in_position)
297 : orientation(in_orientation), position(in_position) {}
298};
299
314
321 uint32_t width;
322
324 uint32_t height;
325
327 uint32_t area;
328
333
339 SonyOzDisplayResolution(uint32_t in_width, uint32_t in_height)
340 : width(in_width), height(in_height), area(width * height) {}
341};
342
349 float width_m;
350
352 float height_m;
353
359
365 SonyOzDisplaySize(float in_width_m, float in_height_m)
366 : width_m(in_width_m), height_m(in_height_m) {}
367};
368
386
420
426
431constexpr uint16_t kXrSystemErrorMsgSize = 512;
434 int32_t code = 0;
436
439 const char* in_msg)
440 : result(in_result), code(in_code) {
441 strcpy_s(msg, sizeof(msg), in_msg);
442 };
443};
444
445enum class SonyOzPoseId : int32_t {
446 HEAD = 0,
447 LEFT_EYE = 1,
448 RIGHT_EYE = 2,
449};
450
457
458struct ID3D11Device;
459struct ID3D11Texture2D;
460struct ID3D12CommandQueue;
461struct ID3D12Resource;
462struct ID3D11Resource;
463struct ID3D11RenderTargetView;
464struct ID3D11ShaderResourceView;
465
466#if defined(_WIN32)
467 enum DXGI_FORMAT;
468#else
472#endif
473
474#endif // XR_API_DEFS_H_
Device information.
Definition xr_api_defs.h:132
SonyOzRect primary_monitor_rectangle
Coordinates of a primary monitor on virtual screen.
Definition xr_api_defs.h:146
SonyOzDeviceInfo(const SonyOzDeviceInfo &obj)
Definition xr_api_defs.h:149
SonyOzDeviceInfo()
Definition xr_api_defs.h:148
char device_serial_number[kDeviceSerialNumberMaxSize]
Serial number.
Definition xr_api_defs.h:137
SonyOzRect target_monitor_rectangle
Coordinates of SR Display on virtual screen.
Definition xr_api_defs.h:143
char product_id[kDeviceProductIdMaxSize]
Product id of the device.
Definition xr_api_defs.h:140
uint32_t device_index
device index Japanese デバイスのインデックス
Definition xr_api_defs.h:134
Display resolution.
Definition xr_api_defs.h:319
uint32_t width
Display width resolution in px.
Definition xr_api_defs.h:321
uint32_t height
Display height resolution in px.
Definition xr_api_defs.h:324
SonyOzDisplayResolution(uint32_t in_width, uint32_t in_height)
Constructor Specify the display width resolution in px Specify the display height resolution in px.
Definition xr_api_defs.h:339
SonyOzDisplayResolution()
Constructor.
Definition xr_api_defs.h:332
uint32_t area
Display area.
Definition xr_api_defs.h:327
Dispaly dimension.
Definition xr_api_defs.h:347
SonyOzDisplaySize(float in_width_m, float in_height_m)
Constructor Specify the width (in meters) of the display Specify the width (in meters) of the display...
Definition xr_api_defs.h:365
float height_m
Display width in meters.
Definition xr_api_defs.h:352
SonyOzDisplaySize()
コンストラクタ
Definition xr_api_defs.h:357
float width_m
Display width in meters.
Definition xr_api_defs.h:349
Display information.
Definition xr_api_defs.h:391
SonyOzDisplaySpec(SonyOzDisplaySize in_display_size, SonyOzDisplayResolution in_display_resolution, float in_display_tilt_rad)
Constructor.
Definition xr_api_defs.h:413
SonyOzDisplayResolution display_resolution
Display resolution ディスプレイの解像度
Definition xr_api_defs.h:396
SonyOzDisplaySpec()
Constructor.
Definition xr_api_defs.h:404
SonyOzDisplaySize display_size
Display dimension.
Definition xr_api_defs.h:393
float display_tilt_rad
Display tilt.
Definition xr_api_defs.h:399
FOV of rendering camear.
Definition xr_api_defs.h:180
float angle_up
Upward viewing angle.
Definition xr_api_defs.h:183
float angle_left
Leftward viewing angle.
Definition xr_api_defs.h:181
float angle_down
Downward viewing angle.
Definition xr_api_defs.h:184
SonyOzFovf()
Constructor.
Definition xr_api_defs.h:189
float angle_right
Rightward viewing angle.
Definition xr_api_defs.h:182
SonyOzFovf(float in_angle)
Constructor Specify the same value for viewing angles in the left, right, up, and down wards.
Definition xr_api_defs.h:196
SonyOzFovf(float in_angle_left, float in_angle_right, float in_angle_up, float in_angle_down)
Constructor Leftward viewing angle Rightward viewing angle Upward viewing angle Downward viewing angl...
Definition xr_api_defs.h:209
Definition xr_api_defs.h:225
float viewBottom
Definition xr_api_defs.h:228
float viewTop
Definition xr_api_defs.h:229
SonyOzFrustumPlanesf(float horizontal_fov, float vertical_fov, float near_clip, float far_clip)
Constructor.
Definition xr_api_defs.h:240
SonyOzFrustumPlanesf(float in_view_left, float in_view_right, float in_view_bottom, float in_view_top, float in_near_z, float in_far_z)
Constructor.
Definition xr_api_defs.h:257
float nearZ
Definition xr_api_defs.h:230
float farZ
Definition xr_api_defs.h:231
SonyOzFrustumPlanesf()
Constructor.
Definition xr_api_defs.h:252
float viewRight
Definition xr_api_defs.h:227
float viewLeft
Definition xr_api_defs.h:226
SonyOzFovf ToFov()
Definition xr_api_defs.h:267
Head pose.
Definition xr_api_defs.h:304
SonyOzPosef right_eye_pose
Right eye pose.
Definition xr_api_defs.h:312
SonyOzPosef pose
Pose of the center between eyes.
Definition xr_api_defs.h:306
SonyOzPosef left_eye_pose
Definition xr_api_defs.h:309
4x4 matrix of type float
Definition xr_math.h:167
連結設定時のデバイスの情報
Definition xr_api_defs.h:171
enum SonyOzMultiDisplayMode multi_display_mode
Definition xr_api_defs.h:173
struct SonyOzDeviceInfo device_info
Definition xr_api_defs.h:172
pose(position, orientation)
Definition xr_api_defs.h:279
SonyOzPosef(SonyOzQuaternionf in_orientation, SonyOzVector3f in_position)
Constructor Specify orientation Specify position.
Definition xr_api_defs.h:296
SonyOzQuaternionf orientation
Definition xr_api_defs.h:281
SonyOzVector3f position
Definition xr_api_defs.h:284
SonyOzPosef()
Constructor.
Definition xr_api_defs.h:289
Definition xr_api_defs.h:451
float half_angles_left
Definition xr_api_defs.h:452
float half_angles_bottom
Definition xr_api_defs.h:455
float half_angles_right
Definition xr_api_defs.h:453
float half_angles_top
Definition xr_api_defs.h:454
Projection matrix.
Definition xr_api_defs.h:373
SonyOzMatrix4x4f left_projection
Definition xr_api_defs.h:380
SonyOzMatrix4x4f right_projection
Definition xr_api_defs.h:384
SonyOzMatrix4x4f projection
Definition xr_api_defs.h:376
quaternion of type float
Definition xr_math.h:32
Rectangle.
Definition xr_api_defs.h:112
int32_t bottom
x-coordinate of lower side
Definition xr_api_defs.h:123
int32_t right
x-coordinate of right side
Definition xr_api_defs.h:120
int32_t left
x-coordinate of left side
Definition xr_api_defs.h:114
int32_t top
x-coordinate of upper side
Definition xr_api_defs.h:117
3D vector of type float
Definition xr_math.h:72
Sytem error occurred in XR Runtime.
Definition xr_api_defs.h:432
SonyOzXrSystemError()
Definition xr_api_defs.h:437
int32_t code
Definition xr_api_defs.h:434
SonyOzXrSystemErrorResult result
Definition xr_api_defs.h:433
char msg[kXrSystemErrorMsgSize]
Definition xr_api_defs.h:435
SonyOzXrSystemError(SonyOzXrSystemErrorResult in_result, int32_t in_code, const char *in_msg)
Definition xr_api_defs.h:438
const float kDefaultDisplayTilt_rad
Definition xr_api_defs.h:54
const uint32_t kDeviceProductIdMaxSize
Definition xr_api_defs.h:131
SonyOzXrSystemErrorResult
Type of error occurred in XR Runtime.
Definition xr_api_defs.h:425
const uint32_t kDeviceSerialNumberMaxSize
Definition xr_api_defs.h:130
SonyOzPoseId
Definition xr_api_defs.h:445
@ RIGHT_EYE
Pose ID specifying the right eye.
@ LEFT_EYE
Pose ID specifying the left eye.
@ HEAD
Pose ID specifying the center between eyes.
DXGI_FORMAT
Definition xr_api_defs.h:469
@ DXGI_FORMAT_UNKNOWN
Definition xr_api_defs.h:470
const char * SonyOzPlatformId
ID indicating XR platform. It will always be "Spatial Reality Display".
Definition xr_api_defs.h:93
const float kDefaultDisplayHeight_m
Definition xr_api_defs.h:53
SonyOzMultiDisplayMode
Definition xr_api_defs.h:162
SonyOzSessionState
session state
Definition xr_api_defs.h:99
@ STARTING
The session is starting.
@ READY
The session is ready.
@ RUNNING
The session is running.
@ UNKNOWN
Unknown state.
@ IDLE
The session is idle.
const uint32_t kDefaultVerticalResolution_px
Definition xr_api_defs.h:56
const uint32_t kDefaultHorizontalResolution_px
Definition xr_api_defs.h:55
constexpr uint16_t kXrSystemErrorMsgSize
Definition xr_api_defs.h:431
SonyOzResult
Result of XR Runtime API.
Definition xr_api_defs.h:62
@ ERROR_SESSION_CREATED
A session is already created.
@ ERROR_SESSION_READY
A session is already ready.
@ ERROR_DEVICE_NOT_FOUND
Failed to find the device.
@ ERROR_RUNTIME_UNSUPPORTED
This API is not supported.
@ ERROR_SESSION_STARTING
A session is already starting.
@ ERROR_GET_DATA_FAILURE
Failed to get data.
@ ERROR_FILE_ACCESS_ERROR
Failed to access the file.
@ ERROR_RUNTIME_NOT_FOUND
XR Runtime is not installed.
@ ERROR_SET_DATA_FAILURE
Failed to set data.
@ ERROR_RUNTIME_FAILURE
Problems with XR Runtime.
@ ERROR_POSE_INVALID
Failed to obtain correct pose.
@ ERROR_SESSION_STILL_USED
A session is still used.
@ ERROR_SESSION_STOPPING
A session is already stopping.
@ SUCCESS
Success.
@ ERROR_SESSION_NOT_RUNNING
A session is not running.
@ ERROR_HANDLE_INVALID
Invalid handle.
@ ERROR_VALIDATION_FAILURE
Invalid argument.
@ ERROR_SESSION_NOT_READY
A session is not ready.
@ ERROR_FUNCTION_UNSUPPORTED
Unsupported function called.
@ ERROR_SESSION_RUNNING
A session is already running.
@ ERROR_SESSION_NOT_CREATE
A session is not created.
const float kDefaultDisplayWidth_m
Definition xr_api_defs.h:52